package daotests;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class GenericSpringHibernateDao<T>  extends HibernateDaoSupport implements IGenericDao<T> {

    public GenericSpringHibernateDao() { 
    	
    }

    public void saveOrUpdate(T obj) {
        getHibernateTemplate().saveOrUpdate(obj);
    }

    public void delete(T obj) {
        getHibernateTemplate().delete(obj);
    }

     public T find(Class<T> clazz, Long id) {
        return getHibernateTemplate().load(clazz, id);
    }

    public List<T> findAll(Class<T> clazz) {
        return getHibernateTemplate().find("from " + clazz.getName());
    }
}
